<%@page import="java.sql.*"%>
<%@page import="java.util.*"%>
<%@page import="conexao.ConexaoBD"%>
<%@page import="javax.servlet.*"%>
<%@page import="javax.servlet.http.*"%>


<%
  if (session.getAttribute("autorizado")==null)
     response.sendRedirect("index.html");

   Vector vNome = new Vector();
   Vector vFone = new Vector();
   Vector vEmail = new Vector();
   String login = request.getSession().getAttribute("autorizado").toString();

   String sql="Select * FROM amigos where login ='"+ login+"'";

   ConexaoBD con = null;
    try{
         con = new ConexaoBD();
          ResultSet rs = con.executeQuery(sql);

          while (rs.next()){
           vNome.addElement(rs.getString("nome"));
           vFone.addElement(rs.getString("fone"));
           vEmail.addElement(rs.getString("email"));
        }
      }
       catch (SQLException e){
         out.println("Erro no SQL!"+e.getMessage());
        return;
       }
       finally {
        if (con!=null){
         con.fecharConexao();
         con=null;
       }
     }

%>
<html>
<head>
<title>WebAgenda - Sua agenda na NET</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<div align="center">
  <p><a href="menu.jsp"><img src="imagens/bt_voltar2.gif" width="117" height="27" border="0"></a></p>
  <p>&nbsp;</p>
</div>
<table border="0" width="100%">
  <tr>
    <td width="45%" bgcolor="#006699" align="center"><b><font color="#FFFFFF">None</font></b></td>
    <td width="25%" bgcolor="#006699" align="center"><b><font color="#FFFFFF">Fone</font></b></td>
    <td width="30%" bgcolor="#006699" align="center"><b><font color="#FFFFFF">E-mail</font></b></td>
  </tr>


<% for(int i=0;i<vNome.size();i++){ %>
  <tr>
    <td width="45%" bgcolor="#FFFFFF">
      <% out.print(vNome.elementAt(i));%>
    </td>
    <td width="25%">
      <%out.print(vFone.elementAt(i)); %>
    </td>
    <td width="30%" bgcolor="#FFFFFF">
<% out.print(vEmail.elementAt(i));%>
    </td>
  </tr>
<%    } %>
</table>
</body>
</html>